/**
 * 게시판과 관련된 자바스크립트.2014.11.3
 */
var btnList, btnInput, btnModify, btnDelete, btnView;
var url = 'index.jsp?inc=./board/';
function general(){
	
	btnList = document.getElementById('btnList');
	if(btnList != null){
		btnList.onclick = function(){
			location.href=url+'list.jsp';
			
		}
	}
	btnInput = document.getElementById('btnInput');
	if(btnInput != null){
		btnInput.onclick = function(){
			location.href=url+'input.jsp';
		}
	}
	btnModify =document.getElementById('btnModify')
	if(btnModify != null){
		btnModify.onclick = function(){
			var b = confirm("정말 수정");
			if(b){
				var f = document.hiddenfrm;
				f.action = url+'modify.jsp';
				f.submit();
		}else{
			alert("삭제취소");
		}
		}
	}
	btnDelete= document.getElementById('btnDelete');
	if(btnDelete != null){
		btnDelete.onclick = function(){
			var b = confirm("정말 삭제");
			if(b){
				var f = document.hiddenfrm;
				f.action = url+'delete_result.jsp';
				f.submit();
			}else{
				alert("삭제취소");
			}
		}
	}
	btnView = document.getElementById('btnView');
	if(btnView != null){
		btnView.onclick = function(){
			var f = document.hiddenfrm;
			f.action = url + 'view.jsp';
			f.submit();
		}
	}
}

function goView(page, mid) {
	var kk = document.hidfrm;
	kk.nowPage.value = page;
	kk.mid.value = mid;
	kk.action = 'index.jsp?inc=./board/view.jsp';
	kk.submit();
}

function goPage(page){
	var mf = document.hidfrm;
	mf.nowPage.value = page;
	mf.find.value = document.board_list_frm.find.value;
	mf.action = 'index.jsp?inc=./board/list.jsp';
	mf.submit();
}

function inputInit() {// input과 관련된 모듈
	general();
	document.getElementById('btnSave').onclick =function(){
		var f = document.frm;
		if(f.mid.value==""){
			alert("아이디를 입력하세요");
			f.mid.focus();
		}else{
			f.submit();
		}
	}
}

function modifyInit(){
	general();
	document.getElementById('btnSave').onclick =function(){
		var f = document.frm;
		if(f.mid.value==""){
			alert("아이디를 입력하세요");
			f.mid.focus();
		}else{
			f.submit();
		}
	}
}
function listInit() {
	general();
}
function viewInit(){
	general();
}
function deleteInit(){
	general();
}